package org.learn.spring5.service.impl;

import org.learn.spring5.dao.impl.UserDaoImpl;
import org.learn.spring5.entiy.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    //注入UserDao的对象
    @Autowired
    private UserDaoImpl userDao;

    //添加用户操作
    public void addUser(User user) {
        userDao.add(user);
    }

    public int update(User user) {
        return userDao.update(user);
    }

    public int del(Integer id) {
        return userDao.del(id);
    }

    public int queryCount() {
        return userDao.queryCount();
    }

    public User queryById(Integer id) {
        return userDao.findOne(id);
    }

    public List<User> findAll() {
        return userDao.findAll();
    }

    public void batchAdd(List<Object[]> users) {
        userDao.batchAdd(users);
    }

    public void batchUpdate(List<Object[]> users) {
        userDao.batchUpdate(users);
    }

    public void batchDel(List<Object[]> users) {
        userDao.batchDel(users);
    }
}
